// SPDX-License-Identifier: Mulan PSL v2
// Temporary mock implementations for testing without xgpu-common dependency

pub mod ipc {
    pub mod framer {
        use thiserror::Error;

        #[derive(Error, Debug)]
        pub enum GenericFramerError {
            #[error("Mock framer error")]
            MockError,
        }

        pub struct GenericFramer {
            max_len: usize,
        }

        impl GenericFramer {
            pub fn new(max_len: usize) -> Self {
                Self { max_len }
            }
        }
    }

    pub mod transport {
        pub mod shmem {
            use thiserror::Error;

            #[derive(Error, Debug)]
            pub enum ShmemTransportError {
                #[error("Mock transport error")]
                MockError,
            }

            pub struct ShmemTransport;
            
            pub struct ShmemTransportBuilder {
                path: String,
                size: usize,
            }

            impl ShmemTransportBuilder {
                pub fn new() -> Self {
                    Self {
                        path: String::new(),
                        size: 0,
                    }
                }

                pub fn path(mut self, path: &str) -> Self {
                    self.path = path.to_string();
                    self
                }

                pub fn size(mut self, size: usize) -> Self {
                    self.size = size;
                    self
                }

                pub fn build(self) -> Self {
                    self
                }

                pub fn create(self) -> Result<ShmemTransport, ShmemTransportError> {
                    Ok(ShmemTransport)
                }
            }
        }
    }

    pub mod message {
        pub struct Request<'a> {
            method_id: u64,
            _phantom: std::marker::PhantomData<&'a ()>,
        }

        impl<'a> Request<'a> {
            pub fn new(method_id: u64) -> Self {
                Self {
                    method_id,
                    _phantom: std::marker::PhantomData,
                }
            }

            pub fn method_id(&self) -> u64 {
                self.method_id
            }

            pub fn argc(&self) -> usize {
                0
            }

            pub fn argv(&self, _index: usize) -> Option<&Argument> {
                None
            }
        }

        pub struct Argument;
    }
}